<template>
	<view class="article-detail" :style="css.page+'min-height:'+$xyfun.xysys().windowHeight+'px'" v-if="!empty">
		<!--view class="tb tc p-30 ts-32">{{article.title}}</view-->
		<view class="content p-30">
			<rich-text :nodes="article.content"></rich-text>
		</view>
	</view>
</template>

<script>
	
	export default {
		
		data() {
			return {
				css:{},
				empty:true,
				id: 103,
				article:{},
			}
		},
		onLoad(options) {
			var that = this;
			if(options){
				this.id = options.id;
			}
			this.$xyfun.setNavBg();
			this.css = this.$xyfun.css();
			that.loadData();
		},
		methods: {
			
			loadData(){
				this.$api.get({
					url: '/article/detail',
					loadingTip:'加载中...',
					data: {
						id:this.id,
					},
					success: res => {
						this.empty = false;
						this.article = res;
						this.article.content = this.article.content.replace(/\<img/g, "<img style='max-width: 100%;vertical-align: middle;'");
						this.$xyfun.setNavTitle(res.title);
					}
				});
			},
			
			
			
		}
	}
</script>

<style scoped lang="scss">
	.article-detail{
		.content{text-align: justify;}
	}
</style>
